<template>
  <div class="app-box">
    <!-- <button @click="startBar">测试开闸</button>
    <button @click="testReadCard">测试读卡</button>
    <button @click="testWriteCard">测试写卡</button> -->

    <Layout ref="runBox"
            title="GateInCheckPonit 终端"
            temp="Temp2"
            @handleSuccessMqttMessage="handleSuccessMqttMessage"
            :ic="ic"
            :url="url"
            :readID="false"
            :readIC="true"></Layout>

  </div>
</template> 
<script>
import {
  log,
} from '@/utils/message'
import Layout from '../core/layout.vue'
import { GSAConstants } from '@/utils/access'

export default {
  components: { Layout },
  data () {
    return {
      ic: GSAConstants().TOPIC_TO_GPS.ic,
      url: GSAConstants().TOPIC_TO_GPS.url
    }
  },
  created () {
  },
  mounted () {
  },
  methods: {
    showMsg (msg, type) {
      this.$refs.runBox.showMsg(msg, type)
    },

    // 读卡成功的回调信息
    handleSuccessMqttMessage (messageObject) {
      log('to-gps 开始处理业务', messageObject, ', current IC', this.ic)
      if (messageObject.ic === this.ic) {
        this.showMsg('作业处理成功', 'green')
        this.$refs.runBox.handleSuccess()
      }
    }
  },
}
</script>

<style scoped>
.app-box {
  padding: 0px;
}
</style>